<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title></title>
</head>
<body>
	bvv
	<audio id='audio' loop="loop">
		<source src="./public/notice.wav" type="audio/mpeg">
	</audio>
</body>
</html>
<script type="text/javascript">
	document.addEventListener('plusready', function(){

		setInterval(function(){
			_checkStat();			
		},1000)
		
	});
	

	function _checkStat(){
		Ajax({},function(res){
			//状态文件存在则播放提示音乐 
			if(res.stat == 'ok'){
				document.getElementById('audio').play();
				setTimeout(function(){
					document.getElementById('audio').pause(); 
					//删除状态文件
					Ajax({},function(res){
						
					},'http://www.bm123.top/a.php?type=delStatFile','p');
				},3000)
			}
		},'http://www.bm123.top/b');
	}
	
	function W(r){
		document.write(r);
	}
	
	
	function C(r){
		console.log(r);
	}
	
	
	function Ajax(data,fun,url,p){
		var xhr = new plus.net.XMLHttpRequest();
		xhr.onreadystatechange = function() {
			if(xhr.readyState == 4 && xhr.status == 200){
				var data = {
					stat:'ok',
					data:xhr.responseText
				}
				if(fun) fun(data);					
			}else{
				setTimeout(function(){
					if(xhr.readyState != 4 || xhr.status != 200){
						var data = {
							stat:'err',
							data:xhr
						}
						if(fun) fun(data);					
					}
				},3000) 
			}
		}
		if(p){
			p = 'POST';
		}else{
			p = 'GET';
		}
		xhr.open(p, url);
		xhr.send(JSON.stringify(data));
	}  
</script>